package routes

import (
	"io"
	"os"

	"github.com/gin-gonic/gin"

	"test.com/app/controllers"
	"test.com/app/headlers"
)

func GetRoute() *gin.Engine {
	// 创建gin日志
	file, err := os.Create("gin.log")
	headlers.CheckErr(err)
	// 不在终端显示访问记录, 写入gin.log中
	gin.DefaultWriter = io.MultiWriter(file)
	app := gin.Default()
	// routes
	app.GET("user/:id", controllers.UserIndex)
	return app
}
